package com.some;

import java.util.ArrayList;
import java.util.Scanner;

public class Boss02 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        int count = 0;
        while(num/10 != 0) {
            ArrayList<Integer> a = new ArrayList<>();
            while(num != 0) {
                a.add(num%10);
                num = num / 10;
            }
            int m = 1;
            for(int i=0; i<a.size(); i++) {
                m *= a.get(i);
            }
            num = m;
            count ++;
        }
        System.out.println(count);
        in.close();
    }
}
